
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include"pic18f24k22.h"
#include "systimer.h"

/*
extern uint8_t ADCSumCnt;

extern uint32_t ADCBoardChSum;
extern uint32_t ADCBoardChResult;

extern uint32_t ADCTestChSum;
extern uint32_t ADCTestChResult;
 */
void interrupt high_priority SystemServer() {
    volatile WORD_VAL DataCal;

    if (INTCONbits.T0IF && INTCONbits.T0IE) {
        INTCONbits.T0IF = 0;
        DataCal.byte.LB = TMR0L;
        DataCal.byte.HB = TMR0H;
        DataCal.Val += Timer0StartVal;
        TMR0H = DataCal.byte.HB;
        TMR0L = DataCal.byte.LB;
        return;
    }

    if (PIR1bits.TMR2IF && PIE1bits.TMR2IE) {
        PIR1bits.TMR2IF = 0;
        SysTickCnt++;
        return;
    }

    if(PIR2bits.TMR3IF && PIE2bits.TMR3IE){
        PIR2bits.TMR3IF = 0;
        return;
    }
}

void interrupt low_priority UserServer() {

}
